<?php

namespace WenRuns\Laravel\Admin\Form\Field\Grid\Field;

use WenRuns\Laravel\Admin\Form\Field\Grid\Column;

class PowerSwitch extends Column
{
    protected $type = 'switch';

    protected function initialization()
    {
        $this->configs([
            'options' => [
                'size' => 'auto',
                'onText' => 'ON',
                'offText' => 'OFF',
                'onColor' => 'primary',
                'offColor' => 'default',
            ]
        ]);
        return parent::initialization(); // TODO: Change the autogenerated stub
    }


    public function options(array $options)
    {
        $this->configs['options'] = array_merge($this->configs['options'], $options);
        return $this;
    }

    public function option($name, $value)
    {
        $this->configs['options'][$name] = $value;
        return $this;
    }

    public function onChange(string $jsCallback)
    {
        return $this->config('onChange', $jsCallback);
    }
}
